﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IOTestMain.Classes
{
   /*
     The Class for linked List
     1 -> 2 -> 3

     TODO: if one element want to remove from the List
     add new element into list.
     
    */
    public class GenericTest<T>
    {
        private T tValue;
        private GenericTest<T> next;

        public GenericTest(T t)
        {
            this.tValue = t;
        }

        public GenericTest<T> Next
        {
            get { return next; }
            set { next = value; }
        }

        public T TValue
        {
            get { return tValue; }
        }
    }

    public class GenericTest
    {
        public void main()
        {
            GenericTest<int> start = new GenericTest<int>(0);
            GenericTest<int> p = start;
            for (int i = 1; i < 100; i++)
            {
                GenericTest<int> newItem = new GenericTest<int>(i);
                p.Next = newItem;
                p = newItem;
            }

            p = start;
            for (; p.Next != null; p = p.Next)
            {
                Console.WriteLine(p.TValue.ToString());
            }
        }
    }
}
